<?php

namespace App\Service;

use Hyperf\Di\Annotation\Inject;
use Hyperf\Logger\LoggerFactory;
use JsonException;

class PayLogService {

    /**
     * @Inject
     * @var LoggerFactory
     */
    private $loggerFactory;

    public function __construct($type, $orderNum, string $text, $game_hash, $openid) {
        $logger = $this->loggerFactory->get($type, 'paylog');
        $logger->info(json_encode([
            'orderNum'  => $orderNum,
            'game_hash' => $game_hash,
            'openid'    => $openid,
        ]), [
            'request'  => [],
            'response' => $text
        ]);
    }

}
